from datetime import datetime

from pydantic import BaseModel, Field
from schemas import GMT


class CaseInterfaceListIn(BaseModel):
    name: str = Field(example="用例接口列表名称")
    description: str = Field(example="用例接口列表描述")
    requestMethod: str = Field(example="请求方法")
    route: str = Field(example="请求路径")
    createName: str = Field(example="创建者")
    updateName: str = Field(example="最后更新人")
    testResult: dict = Field(example="测试结果")
    status: bool = Field(example=True)
    requestProtocol: str = Field(example="请求协议")
    domain: str = Field(example="主域名")
    isClearCookie: bool = Field(example="是否清除Cookie?false:true")
    headers: list = Field(example="请求头")
    requestParams: str = Field(example="请求参数")
    setGlobalVars: list = Field(example="返回结果设置全局变量")
    checkHttpCode: str = Field(example="HTTP状态校验")
    checkResponseTime: float = Field(example="接口耗时校验")
    checkResponseData: list = Field(example="JSON正则校验")

    projectId: int = Field(example="项目ID")
    caseListId: int = Field(exampel="接口列表ID")


class CaseInterfaceListCreate(CaseInterfaceListIn):
    pass


class CaseInterfaceListUpdate(CaseInterfaceListIn):
    pass


class CaseInterfaceListOut(CaseInterfaceListIn, GMT):
    id: int = Field(example="编号")

    class Config:
        orm_mode = True
